package org.lennon.demo.ddd.ticket.repository.impl;

import org.lennon.demo.ddd.ticket.aggregate.Ticket;
import org.lennon.demo.ddd.ticket.repository.TicketRepository;
import org.lennon.demo.ddd.ticket.builder.TicketBuilder;
import org.lennon.demo.ddd.ticket.dao.UserTicketMapper;
import org.lennon.demo.ddd.ticket.dao.UserTicketRecordMapper;
import org.lennon.demo.ddd.ticket.entity.UserTicketEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class TicketRepositoryImpl implements TicketRepository {

    @Autowired
    private UserTicketMapper userTicketMapper;

    @Override
    public void save(Ticket ticket) {

    }

    @Override
    public Ticket findByUserId(Long userId) {
        UserTicketEntity userTicketEntity = userTicketMapper.findByUserId(userId);
        return TicketBuilder.toTicket(userTicketEntity);
    }
}
